using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel.Design;

namespace Ferpect.GameComponents.Design
{
    /// <summary>
    /// This optional attribute can be used to specify that a non-default ViewControlDesigner
    /// should be used by the ViewControl.  The ViewControl custom type descriptor will convert
    /// these into DesignerAttributes on the ViewControl instance.
    /// 
    /// The point of doing this is to be able to specify designers for both the component and
    /// the view control, since both are added to the design surface at the same time.  It also
    /// lets you design and test your component independently of the view control.
    /// 
    /// I'm not really sure if this is super valuable.  Stripping off the DesignerSerializer
    /// and DesignTimeVisible attributes will make the component behave like a normal component.
    /// </summary>
    public class ViewDocumentDesignerAttribute : Attribute
    {
        private string designerType;

        public ViewDocumentDesignerAttribute(Type rootDesignerType)
        {
            if (rootDesignerType == null) throw new ArgumentNullException("rootDesignerType");
            this.designerType = rootDesignerType.AssemblyQualifiedName;
        }

        public ViewDocumentDesignerAttribute(string designerTypeName)
        {
            if (designerTypeName == null) throw new ArgumentNullException("designerTypeName");
            this.designerType = designerTypeName;
        }

        public string DesignerTypeName
        {
            get
            {
                return this.designerType;
            }
        }

        public string BaseDesignerTypeName
        {
            get
            {
                return typeof(IRootDesigner).AssemblyQualifiedName;
            }
        }
    }
}
